package com.top.dao;


public class DAOFactory {
    private static UserDao userDaoInstance;
    private static FoodDao foodDaoInstance;
    private static OrderDao orderDaoInstance;
    private static OrderItemDao orderItemDaoInstance;
    private static CategoryFoodDao categoryFoodDao;


    public static synchronized FoodDao getFoodDAOInstance(){
        if(foodDaoInstance == null){
            foodDaoInstance = new FoodDao();
        }
        return foodDaoInstance;
    }

    public static synchronized OrderDao getOrderDAOInstance(){
        if(orderDaoInstance == null){
            orderDaoInstance = new OrderDao();
        }
        return orderDaoInstance;
    }

    public static synchronized OrderItemDao getOrderItemDAOInstance(){
        if(orderItemDaoInstance == null){
            orderItemDaoInstance = new OrderItemDao();
        }
        return orderItemDaoInstance;
    }

    public static synchronized CategoryFoodDao getCategoryFoodDAOInstance(){
        if(categoryFoodDao == null){
            categoryFoodDao = new CategoryFoodDao();
        }
        return categoryFoodDao;
    }

    public static synchronized UserDao getUserDAOInstance(){
        if(userDaoInstance == null){
            userDaoInstance = new UserDao();
        }
        return userDaoInstance;
    }


}
